---
category: Date Time
created: '2021-02-25'
title: Get the first date in the month of a date
updated: '2021-10-13'
---

**JavaScript version**

```js getFirstDate.js
const getFirstDate = (d = new Date()) => new Date(d.getFullYear(), d.getMonth(), 1);
```

**TypeScript version**

```ts getFirstDate.ts
const getFirstDate = (d = new Date()): Date => new Date(d.getFullYear(), d.getMonth(), 1);
```
